package com.hibuy.pc.controller;

import com.hibuy.pc.model.shiro.User;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * Created by admin on 2017/12/28.
 */
@Controller
@RequestMapping("common")
public class CommonController {

    @RequestMapping(value = "/top",method = RequestMethod.GET)
    public String toCommon(HttpServletRequest request){
        return "common/top";
    }

    @RequestMapping(value = "/main",method = RequestMethod.GET)
    public String toMain(HttpServletRequest request){
        return "common/main";
    }

    @RequestMapping(value = "/left",method = RequestMethod.GET)
    public String toLeft(HttpServletRequest request){
        //获取当前的Subject
        Subject currentUser = SecurityUtils.getSubject();
        User user = (User) currentUser.getSession().getAttribute("currentUser");
        return "common/left";
    }

    @RequestMapping(value = "/index",method = RequestMethod.GET)
    public String toIndex(HttpServletRequest request){
        return "common/index";
    }

}
